import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'


const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/HomeView.vue')
  },
  {
    path: '/login',
    name: 'login',

    component: () => import('@/views/LoginView.vue'),
    children: [
      {
        path: 'log',
        name: 'login-log',
        component: () => import('@/components/antLoginBox.vue')
      },
      {
        path: 'register',
        name: 'login-reg',
        component: () => import('@/components/antRegisterBox.vue')
      },
      {
        path: 'password',
        name: 'update-password',
        component: () => import('@/components/updatePasswordBox.vue')
      }
    ],
    redirect: {
      name: 'login-log'
    },
  },
  {
    path: '/chat',
    name: 'chat',
    component: () => import('@/views/ChatView.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/SearchView.vue')
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('@/views/UserView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
